package wechat

import (
	"time"
)

const (
	MSGTYPE_NULL             = "0"
	MSGTYPE_REG_NAME         = "1"
	MSGTYPE_REG_LOCATION     = "2"
	MSGTYPE_REG_PHONE        = "3"
	MSGTYPE_REG_HEADPIC_TEXT = "4"
	MSGTYPE_REG_HEADPIC_IMG  = "5"
)

type User struct {
	UserID          string    `json:"userid" xorm:"PK 'userid'"`
	Name            string    `json:"_name" xorm:"'name'"`
	Location        string    `json:"_location" xorm:"'location'"`
	Address         string    `json:"_address" xorm:"'address'`
	DetailAddr      string    `json:"detailaddress" xorm:"'detailaddress'"`
	TelePhone       string    `json:"telephone" xorm:"'telephone'"`
	HeadUrl         string    `json:"headurl" xorm:"'headurl'"`
	Aoi             string    `json:"aoi" xorm:"'aoi'"`
	AmapID          string    `json:"_id" xorm:"'amapid'"`
	SubscribeTime   time.Time `json:"subscribetime" xorm:"notnull created 'subscribetime'"`
	UnSubscribeTime time.Time `json:"unsubscribetime" xorm:"deleted 'unsubscribetime'"`
	LocationTime    time.Time `json:"locationtime" xorm:"updated 'locationtime'"`
	Groups          string    `json:"groups" xorm:"'groups'"`
	LastMsgType     string    `json:"lastmsgtype" xorm:"'lastmsgtype'"`
	TransCard       string    `xorm:"'transcard'"`
}

type UserGroup struct {
	GroupID    int       `json:"groupid" xorm:"PK AUTOINCR 'groupid'"`
	GroupName  string    `json:"groupname" xorm:"'groupname'"`
	GroupDesc  string    `json:"groupdesc" xorm:"'groupdesc'"`
	Creater    string    `json:"creater" xorm:"'creater'"`
	CreateTime time.Time `json:"createtime" xorm:"created 'createtime'"`
}

type UserHisLocations struct {
	UserID     string    `xorm:"PK 'userid'"`
	TimeStamp  time.Time `xorm:"PK updated 'timestamp'"`
	Location   string    `xorm:"'location'"`
	Address    string    `xorm:"'address'"`
	DetailAddr string    `xorm:"'detailaddress'"`
	Aoi        string    `xorm:"'aoi'"`
}

func (u *User) TableName() string {
	return "user"
}

func (u *UserGroup) TableName() string {
	return "usergroup"
}

func (u *UserHisLocations) TableName() string {
	return "userhistlocations"
}
